# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Hugo Doria <hugo@archlinux.org>

pkgname=libtorrent-rasterbar
pkgver=2.0.8
pkgrel=4
epoch=1
pkgdesc="A C++ BitTorrent library that aims to be a good alternative to all the other implementations around"
url="https://www.rasterbar.com/products/libtorrent/"
arch=('x86_64')
license=('BSD')
depends=('boost-libs' 'openssl')
makedepends=('boost' 'cmake' 'ninja' 'python-setuptools')
options=('!emptydirs')
source=(https://github.com/arvidn/libtorrent/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz)
sha512sums=('697988feae149876745097bedfbfb4cceae00ffe1cd4ba2063dcb93a8eee9e99344f772b8364e3df1986a50105e386e56b75fe362707d58ba3272139d9beb98f')

prepare() {
  mkdir -p build
}

build() {
  cd build
  cmake -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX="/usr" \
    -DCMAKE_INSTALL_LIBDIR="lib" \
    -Dpython-bindings=ON \
    -Dboost-python-module-name="python" \
    -Dpython-egg-info=ON \
    -GNinja ../$pkgname-$pkgver
  ninja
}

package() {
  cd build
  DESTDIR="$pkgdir" ninja install
  install -Dm644 ../$pkgname-$pkgver/COPYING -t "$pkgdir"/usr/share/licenses/$pkgname/
}
